You write custom CUDA kernels to replace PyTorch operators for speedups.
Implement Exp-Square Affine Gate on x[B,D]: Compute z = x*scale + bias, s = exp(z^2), gate g = sigmoid(alpha*s + beta), output y = x * g. Fuse affine, square, exp, sigmoid, and multiplication in a single grid-stride kernel. Provide a PyTorch reference with nn.Parameters for scale, bias, alpha, beta. Accuracy rtol=1e-3.
